package com.cl.service.impl;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cl.dao.EnterpriseAnnounceDao;
import com.cl.entity.EnterpriseAnnounce;
import com.cl.service.EnterpriseAnnounceService;
@Service
public class EnterpriseAnnounceServiceImplement implements EnterpriseAnnounceService {
	//去dao层进行数据库操作
	
	@Autowired
	private EnterpriseAnnounceDao ead;
	@Override
	public String job_posting(EnterpriseAnnounce ea) {
		//1 判断是否存在相同职位名称的有效招募信息 （为数据记录加上有效标示字段 方便之后的逻辑删除
		//2不存在 则将招聘信息存入enterprise_announce表中（存储结果默认成功 不再进行细节处理。
		//3存在    返回发布失败结果
		String rs ;
		String post_name  = ea.getPost_name();
		String sql = "select * from enterprise_announce where post_name =  '"+post_name+"'";
		if(  ead.queryEA(sql).size() <1)   // a. 从数据库中 拿出所有数据 再进行对比  b.加入条件查询 √
		{
			ead.saveEA(ea);
			rs = "0";
		}else {
			rs = "1";
		}
			
		return rs;
	}

}
